home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1997 #1 / Amiga Plus CD - 1997 - No. 01.iso / pd / programmierung / proasm / examples / gtfdemo / gtfdemo.s < prev   
Text File  |  1996-04-12  |  8KB  |  440 lines

  1.  
  2. *---* gtfdevel.q *-------------------------------------------------------------
  3. *
  4. *     Developement program for GTFace gadgets and menus.
  5. *
  6. *     Author        Stefan Walter
  7. *    Version        1.00
  8. *    Last Revision    25.03.93
  9. *
  10. *------------------------------------------------------------------------------
  11. *
  12. * This source is meant to be used for developing gadget and menu lists. What
  13. * you have to do is set either or both TESTGADGETS or/and TESTMENUS. Then you
  14. * can add either or both a gadget or/and a menu list at the end of this source.
  15. * Rules to be followed are described down there.
  16. *
  17. *------------------------------------------------------------------------------
  18.  
  19. *------------------
  20.  
  21. TESTGADGETS    SET    1    ;Remove ';' if testing gadgets
  22. ;TESTMENUS    SET    1    ;Remove ';' if testing menus
  23.  
  24. *------------------
  25. * ProAsm
  26. *
  27. progbase:
  28.     relax
  29.     opt    o+,ow-,sw-,f+
  30.     output    ram:GTFDemo
  31.     odd2error
  32.     exeobj
  33.     mc68000
  34.     base    progbase
  35.  
  36.     incdir    routines:
  37.     incdir    include:
  38.  
  39.  
  40. *------------------
  41. * Tonns of flags...
  42. *
  43. USE_NEWROUTINES    SET    1
  44. gea_progname    equr    "GTFDevel"
  45. cws_DETACH    set    1
  46. version        equr    "1.00"
  47.  
  48.     include    tasktricks.r
  49.     include    gtfxdefs.r
  50.     include    gtfmacros.r
  51.     include    gtfguido.r
  52.     include    basicmac.r
  53.     include    intuition/sghooks.i
  54.  
  55.     NEED_    StringHistoryHookFunction
  56.  
  57.  
  58. *------------------
  59. * Startup and $VER.
  60. *
  61. start:    jmp    AutoDetach(pc)
  62.  
  63.  
  64. *------------------------------------------------------------------------------
  65. *
  66. * Regular startup for WB and CLI.
  67. *
  68. *------------------------------------------------------------------------------
  69.  
  70. *------------------
  71. * Comming from CLI.
  72. *
  73. clistartup:
  74.     lea    progbase(pc),a4
  75.     suba.l    a0,a0
  76.     bsr    ReplySync
  77.     bra.s    commonstartup
  78.  
  79. *------------------
  80. * Comming from WB.
  81. *
  82. wbstartup:
  83.     lea    progbase(pc),a4
  84.  
  85.  
  86. *------------------
  87. * Common part of startup.
  88. *
  89. commonstartup:
  90.     CALL_    InitGTFace
  91.     beq    exit
  92.  
  93. getwindow:
  94.     lea    newwindow(pc),a0
  95.     lea    newwindowtags(pc),a1
  96.     lea    windowkey(pc),a2
  97.     CALL_    OpenScaledWindow
  98.     tst.l    d0
  99.     beq.s    closegtf
  100.  
  101.     moveq    #3,d0
  102.     CALL_    ClearWindow
  103.  
  104.     IFD    TESTGADGETS
  105. getgadgets:
  106.     move.w    #1,MXPatch
  107.     move.l    #12345,NumberPatch
  108.     lea    thetestgadgets(pc),a0
  109.     lea    gadgetkey(pc),a1
  110.     CALL_    CreateGList
  111.     tst.l    d0
  112.     beq    closewindow
  113.  
  114.     CALL_    AddGList
  115.     CALL_    RefreshWindow
  116.     ENDIF
  117.     
  118.     IFD    TESTMENUS
  119. getmenus:    
  120.     lea    thetestmenus(pc),a0
  121.     CALL_    AddMenu
  122.     beq.s    freegadgets
  123.     ENDIF
  124.  
  125. wait:    CALL_    WaitForWindow
  126.     CALL_    GetGTFMsg
  127.     tst.l    d0
  128.     beq.s    wait
  129. \n3:    cmp.l    #4,d0
  130.     bne.s    \n1
  131.     CALL_    RefreshEventHandler
  132. \n1:    cmp.l    #$200,d0
  133.     bne.s    wait
  134.  
  135. freemainmenu:
  136.     IFD    TESTMENUS
  137.     CALL_    RemMenu
  138.     ENDIF
  139.  
  140. freegadgets:
  141.     IFD    TESTGADGETS
  142.     lea    gadgetkey(pc),a1
  143.     CALL_    RemGList
  144.     CALL_    FreeGList
  145.     ENDIF
  146.  
  147. closewindow:
  148.     lea    windowkey(pc),a2
  149.     CALL_    CloseScaledWindow
  150.     
  151. closegtf:
  152.     CALL_    ResetGTFace
  153.  
  154. exit:    bsr    ReplyWBMsg
  155.     moveq    #0,d0
  156.     rts
  157.  
  158.  
  159. *------------------------------------------------------------------------------
  160. *
  161. * Data and includes.
  162. *
  163. *------------------------------------------------------------------------------
  164.  
  165. *------------------
  166.     include    startup4.r
  167.     include    gtface.r
  168.     include    gtfsupport.r
  169.  
  170.  
  171. windowkey:    ds.b    gfw_SIZEOF,0
  172. gadgetkey:    ds.b    gfg_SIZEOF,0
  173.  
  174. myhook:        HistoryHook_        myhiststruct
  175. myhiststruct:    StringHistoryStruct_    stringhistory,1200
  176. stringhistory:    ds.b    1200,0
  177.  
  178.  
  179.  
  180. *------------------------------------------------------------------------------
  181. *
  182. * Window, menus and gadgets.
  183. *
  184. *------------------------------------------------------------------------------
  185.  
  186. newwindowtags:
  187.     dc.l    WA_InnerWidth,0
  188.     dc.l    WA_InnerHeight,0
  189.     dc.l    WA_AutoAdjust,-1
  190.     dc.l    0
  191.  
  192. newwindow:    
  193.     dc.w    0,0        ;l/t
  194.     dc.w    thewinsx,thewinsy    ;w/h
  195.     dc.b    -1,-1        ;pens
  196.     dc.l    $000306        ;idcmp
  197.     dc.l    $2000141f    ;flags    ($400:G00)
  198.     dc.l    0        ;gadget
  199.     dc.l    0        ;checkmark
  200.     dc.l    windowtitle    ;title
  201.     dc.l    0        ;screen
  202.     dc.l    0        ;s bitmap
  203.     dc.w    100,4        ;min w/h
  204.     dc.w    500,200        ;w/h
  205.     dc.w    $1        ;screen mode
  206.  
  207. windowtitle:    dc.b    "GTFDevel v",version,0
  208. processname:    dc.b    "GTFDevel",0
  209.         even
  210.  
  211.     IFD    TESTGADGETS
  212.  
  213. *--------------------------------------
  214. * Gadgets.
  215. *
  216. * Insert your definitions between SetIDCounter_ and GadgetsDone_. Required
  217. * is that you use the GUI macros for positioning and that you start your
  218. * gadgets with BeginGList_ and end them with EndGList_.
  219. *
  220. thetestgadgets:
  221.     SetIDCounter_    1000
  222.     BeginGList_    ListOne
  223.  
  224.     GUINew_
  225.     GUIBoxStart_    BoxOne
  226.  
  227.         GUISize_    15*8,12
  228.         GUIGadget_    BUTTON,ButtonOne
  229.             Underscore_
  230.             TextIn_    "_Simple Button"
  231.  
  232.         GUIBeside_
  233.         GUIAdjust_    15*8
  234.         GUISize_    32,12
  235.         GUIGadget_    BUTTON,ButtonTwo
  236.             Underscore_
  237.             TextLeft_    "_Toggle Button"
  238.             ToggleSelect_
  239.             Selected_
  240.  
  241.         GUIBeside_
  242.         GUISize_    90,12
  243.         GUIGadget_    BUTTON,ButtonThree
  244.             Underscore_
  245.             TextIn_    "_Disabled"
  246.             Disabled_
  247.  
  248.         GUIBelow_    ButtonOne
  249.         GUIAdjust_    ,1
  250.         GUISize_    32,12
  251.         GUIGadget_    CHECKBOX,CheckBoxOne
  252.             Underscore_
  253.             TextRight_    "_CheckBox"
  254.             Checked_
  255.  
  256.         GUIBeside_
  257.         GUIAdjust_    10*8+10*8,-1
  258.         GUIRight_    ButtonThree
  259.         GUISize_    ,14
  260.         GUIGadget_    INTEGER,IntegerOne
  261.             Underscore_
  262.             TextLeft_    "_Integer"
  263.             RightJustified_
  264.             NumberPatch_    100000,NumberPatch
  265.  
  266.     GUIBoxEnd_    BoxOne
  267.  
  268.     GUIBelowBox_    BoxOne
  269.     GUIBoxStart_    BoxTwo
  270.  
  271.         GUIRight_    ButtonThree
  272.         GUISize_    ,5*8
  273.         GUIGadget_    LISTVIEW,ListViewOne
  274.             ShowSelected_
  275.  
  276.     GUIBoxEnd_    BoxTwo
  277.         Recessed_
  278.  
  279.     GUIBelowBox_    BoxTwo
  280.     GUIBoxStart_    BoxThree
  281.  
  282.         GUISize_    10,(4*8+3*2)
  283.         GUIGadget_    MX,MXOne
  284.             TextRight_    0
  285.             Labels_        MXLabels
  286.             ActivePatch_    2,MXPatch
  287.             Spacing_    3
  288.  
  289.         GUIBeside_
  290.         GUIAdjust_    10*8,8+5
  291.         GUIRight_    ButtonThree
  292.         GUISize_    ,12
  293.         GUIGadget_    SLIDER,SliderOne
  294.             RelVerify_
  295.             Min_    10
  296.             Max_    100
  297.             Level_    25
  298.             MaxLevelLen_    14
  299.             LevelFormat_    "Level %ld  "
  300.             LevelPlace_    PLACETEXT_ABOVE
  301.     
  302.         GUIBelow_    SliderOne
  303.         GUISize_    108,14
  304.         GUIGadget_    CYCLE,CycleOne
  305.             Labels_    CycleLabels
  306.             Active_    4
  307.  
  308.         GUIBeside_
  309.         GUIRight_    ButtonThree
  310.         GUISize_    ,14
  311.         GUIGadget_    STRING,StringOne
  312.             TextRight_    0
  313.             String_        "GYAAAAAHH......"
  314.             MaxChars_    100
  315.             TabCycle_
  316.             EditHook_    myhook
  317.  
  318.         
  319.     GUIBoxEnd_    BoxThree
  320.  
  321.     GUIBelowBox_    BoxThree
  322.     GUIBoxStart_    BoxFour
  323.  
  324.         GUIRight_    ButtonThree
  325.         GUISize_    ,14
  326.         GUISpace_    emptyspace1
  327.  
  328.         GUISize_    370,14
  329.         GUICenterX_    BoxFour
  330.         GUICenterY_    BoxFour
  331.         GUIGadget_    BUTTON,okaybutton
  332.           TextIn_    "centered"
  333.  
  334.     GUIBoxEnd_    BoxFour
  335.  
  336.     GUIWindowSize_    winsx,winsy
  337.     EndGList_    ListOne
  338.  
  339.  
  340.  
  341.  
  342.     GUIWindowSize_    thewinsx,thewinsy
  343.  
  344. ;------------------
  345. MXLabels:
  346.     GenLabel_    "First"
  347.     GenLabel_    "Second"
  348.     GenLabel_    "Third"
  349.     GenLabel_    "Last"
  350.     EndLabel_
  351.  
  352. CycleLabels:
  353.     GenLabel_    "Australien"
  354.     GenLabel_    "Europa"
  355.     GenLabel_    "Amerika"
  356.     GenLabel_    "Asien"
  357.     GenLabel_    "Arktis"
  358.     GenLabel_    "Afrika"
  359.     EndLabel_
  360.  
  361.     GadgetsDone_
  362.  
  363. *--------------------------------------
  364.  
  365.     ELSE
  366. thewinsx    EQU    400
  367. thewinsy    EQU    100
  368.     ENDIF
  369.  
  370.     IFD    TESTMENUS
  371.  
  372. *--------------------------------------
  373. * Menus.
  374. *
  375. * Insert your menu definitions between MenuStart_ and MenuEnd_.
  376. *
  377. thetestmenus:
  378.     MenuStart_
  379.  
  380.  
  381.  
  382.  
  383.     MenuTitle_    " Project "
  384.  
  385.         MenuItem_    "About","A",menuabout
  386.           Disabled_
  387.         MenuBar_    -1
  388.         MenuItem_    "Quit","Q",menuquit
  389.  
  390.     MenuTitle_    " Test "
  391.  
  392.         MenuItem_    "Load..."
  393.             MenuSubItem_    "File","F",subfile
  394.               CheckIt_
  395.               Checked_
  396.               Exclude_    subdisk
  397.               Exclude_    subpara
  398.  
  399.             MenuSubItem_    "Disk","D",subdisk
  400.               CheckIt_
  401.               Toggled_
  402.               Exclude_    subfile
  403.  
  404.             MenuSubItem_    "Paralell","P",subpara
  405.               CheckIt_
  406.               Toggled_
  407.               Exclude_    subfile
  408.             
  409.         MenuItem_    "Save..."
  410.             MenuSubItem_    "Now"
  411.               CheckIt_
  412.               Toggled_
  413.               Checked_
  414.  
  415.             MenuSubItem_    "Later"
  416.               CheckIt_
  417.               Toggled_
  418.               Checked_
  419.  
  420.     MenuTitle_    " Master "
  421.  
  422.         MenuItem_    "Executable","L"
  423.         MenuItem_    "File","F"
  424.         MenuItem_    "Bootblock","B"
  425.         MenuItem_    "Project","B"
  426.  
  427.     MenuEnd_
  428.     MenusDone_
  429.  
  430.  
  431. *--------------------------------------
  432.  
  433.     ENDIF
  434.  
  435. *------------------------------------------------------------------------------
  436.  
  437.     end
  438.  
  439.  
  440.